HAL GFXTIM migration: List of applicable concepts

This section provides information about the HAL GFXTIM applicable architecture concepts.

Concepts for GFXTIM

Concept

Description

Separation of initialization and configuration functions

  • Provide the initialization of the handle and link it to a GFXTIM instance with HAL_GFXTIM_Init function.

  • Provide a separate configuration per functional blocks (clock generator for absolute and relative timer, tearing effect detection, event generator and watchdog timer) with the dedicated parameters.

Removal and conversion of init structure to configuration structure

The init structure has been removed from the handle and converted into set configuration per functional blocks function.

Renaming of the handle structure

The handle structure has been renamed to hal_gfxtim_handle_t.

Renaming unitary init structures

The structure GFXTIM_InitTypeDef is no longer available and has been replaced by hal_gfxtim_clkgen_frame_config_t, hal_gfxtim_clkgen_line_config_t, hal_gfxtim_tearing_effect_config_t, hal_gfxtim_eventgen_config_t and hal_gfxtim_wdg_config_t.

Remove MspInit and MspDeInit callbacks

HAL_GFXTIM_MspInit and HAL_GFXTIM_MspDeInit are no longer available and have been replaced by a user sequence to initialize and configure the GFXTIM.

Unitary configuration APIs

New APIs are available to get and set GFXTIM features.

Introduction of HAL user data set/get APIs

Two functions to set/get user data are available: HAL_GFXTIM_SetUserData and HAL_GFXTIM_GetUserData.

Individual callback registration APIs replace global register and unregister functions

The callback registration is handled by specific functions for each GFXTIM event. These functions are used to register callback functions for different GFXTIM events.

HAL implementation with LL inline functions

HAL GFXTIM APIs now rely on LL APIs rather than performing direct register access.

Define statements and enumerations redirected to LL equivalents

HAL GFXTIM define statements and enumerations are based on LL define statements.

Removal of hardware-related macros in HAL2

All hardware macros have been removed from the HAL GFXTIM driver, and equivalent services are ensured through the LL APIs.

Revised and optimized HAL state machine

The GFXTIM state machine is reworked to ensure transitions of the peripheral functional states. The GFXTIM is managed by six state machines:

  1. Global state machine

  2. Clock generator state machine

  3. Absolute line state machine

  4. Absolute frame state machine

  5. Relative timer state machine

  6. Watchdog timer state machine

Revised and optimized HAL API status returns

The HAL ADC functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_ERROR: in case of an error.

  • HAL_TIMEOUT: in case of a user timeout.

  • HAL_OK: in case of a successfully completed operation.

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL GFXTIM driver have been removed and replaced by _t.

Replaced nonmodifiable pointers with const keywords

Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable.

Assertion implementation and usage in HAL1

Parameters and states are checked using ASSERT_DBG_STATE and ASSERT_DBG_PARAM macro.

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Finite parameters (including GFXTIM instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

All HAL GFXTIM functions start with HAL_GFXTIM. All HAL GFXTIM enum and struct start with hal_gfxtim.

Other HAL GFXTIM changes

Concept

Consideration

Add new LL GFXTIM layer.

Provide new LL layer for GFXTIM peripheral to reach the full granularity of features configuration.